

<include file="public@header" />
</head>
<body>
<div class="wrap js-check-wrap">


    <form class="well form-inline margin-top-20" method="get" >


        名称:
        <input type="text" class="form-control" id="name" style="width: 120px;"  placeholder="请输入用户名">


        <input type="button" id="selectval" class="btn btn-primary" value="搜索" />

    </form>



    <table class="table table-hover table-bordered">

        <table class="layui-hide" id="test" lay-filter="test"></table>

        <script type="text/html" id="toolbarDemo">
            <div class="layui-btn-container">

            </div>
        </script>
        <script type="text/html" id="barDemo">

            <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
        </script>

        <!--    自定义     `status` enum('0','1','2','3') DEFAULT '0' COMMENT '状态:0=未使用,1=已使用,2=已赠送,3=已过期',  -->
        <script type="text/html" id="titleTpl">
            {{#  if(d.status == 0){ }}未使用 {{#  } }}
            {{#  if(d.status == 1){ }} 已使用{{#  } }}
            {{#  if(d.status == 2){ }} 已赠送{{#  } }}
            {{#  if(d.status == 3){ }} 已过期{{#  } }}
        </script>
<!--1=赠送,2=后台,0=兑换',-->
        <script type="text/html" id="titleTpl1">
            {{#  if(d.get == 0){ }}用户兑换 {{#  } }}
            {{#  if(d.get == 1){ }} 用户赠送{{#  } }}
            {{#  if(d.get == 2){ }} 后台赠送{{#  } }}
        </script>


        <script type="text/html" id="titleTpl2">
            <a class="layui-btn layui-btn-xs" lay-event="inuser">{{d.inuser}}</a>
        </script>

        <script>
            var id="{$id}";
            layui.use('table', function(){
                var table = layui.table;

                var tableIns =table.render({
                    elem: '#test' ,
                    url:'inuser',
                    method: 'post',
                    where:{id:id},
                    title: '用户数据表',
                    totalRow: true ,
                    limit:9999,
                    cols: [[

                        {field:'game_name', title:'比赛名称',edit: 'text', unresize: true,  totalRowText: '合计'}
                        ,{field:'user_nickname', title:'用户'}
                        ,{field:'', title:'状态', templet: '#titleTpl'}
                        ,{field:'count', title:'数量', totalRow: true,sort: true}
                        ,{field:'gettime', title:'获得时间'}
                        ,{fixed: 'right', title:'操作', toolbar: '#barDemo'}
                    ]]
                    ,page: false,
                    done: function(res, curr, count){
                        console.log(res)
                    }
                });

                $("#selectval").click(function (){


                    var name=$("#name").val();

                    tableIns.reload({
                        where: { name: name,id:id} ,
                        page: false
                    });

                })




            });
        </script>


    </table>

</div>
<script src="__STATIC__/js/admin.js"></script>
</body>
</html>